`
https://leetcode.cn/problems/house-robber/
`

/**
 * @param {number[]} nums
 * @return {number}
 */
var rob = function (nums) {
  const n = nums.length

  // dp[i] 表示从第 i 家开始抢最多能赚多少
  const dp = new Array(n + 2).fill(0)

  for (let i = n - 1; i >= 0; i--) {
    dp[i] = Math.max(dp[i + 1], dp[i + 2] + nums[i])
  }

  return dp[0]
};